<form autocomplete="off" class="layui-form layui-box modal-form-box" action="{:request()->url()}" data-auto="true" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">用户账号</label>
        <div class="layui-input-block">
            {if $vo and $vo.username}
            <input type="text" readonly="" disabled="" name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="layui-input layui-bg-gray">
            {else}
            <input type="text" name="username" value='{$vo.username|default=""}' required="required" title="请输入用户名称" placeholder="请输入用户名称" class="layui-input">
            {/if}
        </div>
    </div>

    {if isset($roles)}
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            {foreach $roles as $role}
            <label class="think-checkbox">
                <!--{if isset($vo['role']) and ($role['id'] eq $vo['role'])}-->
                <input type="radio" checked name="role" value="{$role.id}" lay-ignore> {$role.title}
                <!--{else}-->
                <input type="radio" name="role" value="{$role.id}" lay-ignore> {$role.title}
                <!--{/if}-->
            </label>
            {/foreach}
            {if empty($roles)}<span class="color-desc" style="line-height:36px">未配置角色</span>{/if}
        </div>
    </div>
    {/if}

    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

    <script>window.form.render();</script>
</form>
